<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/static/crm/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/crm/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="/static/crm/css/public.css" media="all">
    <title>Document</title>
</head>

<body>
    <div class="layui-container">
        <div class="layui-col-md6">
            <fieldset class="table-search-fieldset" style="border: solid rgba(0, 255, 106, 0.551);">
                <legend>线索信息</legend>
                <div style="margin: 10px 10px 10px 10px">
                    {volist name = '$list' id = 'list'}
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">商机名称:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="name" autocomplete="off" class="layui-input layui-btn-disabled"
                                    value="{$list.name}">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">预算金额:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="money" autocomplete="off"
                                    class="layui-input layui-btn-disabled" value="{$list.money}">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">预计成交日期</label>
                            <div class="layui-input-inline">
                                <input type="text" name="predict_time" autocomplete="off"
                                    class="layui-input layui-btn-disabled" value="{$list.predict_time}">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">备注:</label>
                            <div class="layui-input-block">
                                <textarea name="remark" class="layui-textarea layui-btn-disabled"
                                    placeholder="">{$list.remark}</textarea>
                            </div>
                        </div>
                    </div>
                    {/volist}
                </div>
            </fieldset>
        </div>

        <div class="layui-col-md6">
            <fieldset class="table-search-fieldset" style="border: solid rgb(0, 208, 255);">
                <legend>跟进操作</legend>
                <div style="margin: 10px 10px 10px 10px">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item">
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">跟进内容:</label>
                                <div class="layui-input-block">
                                    <textarea name="content" lay-verify="required" class="layui-textarea"
                                        placeholder=""></textarea>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">附件:</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="" autocomplete="off" placeholder="可以为空"
                                        class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">下次跟进时间:</label>
                                <div class="layui-input-inline">
                                    <input id="test12" type="text" name="schedule_time" autocomplete="off"
                                        class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">如不需要再跟进设置为空</div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">跟进方式:</label>
                                <div class="layui-input-block">
                                    <select name="type" lay-verify="required">
                                        <option value="0">电话</option>
                                        <option value="1">短信</option>
                                        <option value="2">微信</option>
                                        <option value="3">上门拜访</option>
                                    </select>
                                </div>
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </fieldset>
        </div>
    </div>

    <div class="layui-col-md12">
        <script type="text/html" id="toolbarDemo">
             <button class="layui-btn layui-btn-sm" style="background-color: #393D49;" lay-event="refresh"><i class="fa fa-refresh layui-anim-rotate"></i></button>
    </script>
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
    </div>

</body>

</html>

<script src="/static/crm/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>

<script>
    layui.use(['form', 'laydate', 'jquery', 'table'], function () {
        var form = layui.form,
            layer = layui.layer,
            laydate = layui.laydate,
            table = layui.table,
            $ = layui.jquery;

        laydate.render({
            elem: '#test12'
        });

        table.render({
            elem: '#currentTableId',
            url: 'foop',
            toolbar: '#toolbarDemo',
            cols: [[
                { type: "checkbox" },
                { field: 'id', title: 'ID', sort: true },
                { field: 'content', title: '内容' },
                { field: 'salesman_id', title: '创建人' },
                { field: 'create_time', title: '创建时间' },
                { field: 'schedule_time', title: '下次跟进' },
                { field: 'type', title: '跟进类型' }
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'line'
        });

        form.on('submit(formDemo)', function (data) {
            $.ajax({
                url: 'fpdata',
                type: 'post',
                dataType: 'json',
                data: data.field,
                success: function (data) {
                    if (data.code == 1) {
                        layer.msg(data.msg, {
                            time: 1500,
                            end: function () {
                                table.reload('currentTableId', {
                                    page: {
                                        curr: 1
                                    }
                                }, 'data');
                            }
                        });

                    } else if (data.code == 0) {
                        layer.msg(data.msg);
                    }
                }
            })
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        table.on('toolbar(currentTableFilter)', function (obj) {
            if (obj.event === 'refresh') {
                table.reload('currentTableId', {
                        page: {
                            curr: 1
                        }
                }, 'data');
            }
        });

    });
</script>